<%@page import="java.util.Calendar"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<script type="text/javascript"src="${APP_PATH}/static/js/jquery-1.12.4.min.js"></script>
<link href="${APP_PATH}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="${APP_PATH}/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//alert(1);
	});
	function getTime() {
		var Week, Weekday;
		var date = new Date();
		Week = [ "星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" ];
		Weekday = date.getDay();
		year = date.getFullYear();
		month = date.getMonth() + 1;
		day = date.getDate();
		hours = date.getHours();
		minutes = date.getMinutes();
		seconds = date.getSeconds();
		document.getElementById("getTime").innerHTML = "当前时间：" + year + "年"+ month + "月" + day + "日" + "\t" + hours + ":" + minutes + ":"+ seconds + "\t" + Week[Weekday];
	};
	setInterval("getTime()", 1000);
</script>

</head>
</head>
<body>

	<!-- 显示页面  使用 bootstrap -->
	<div class="container">
		<!-- 标题 -->
		<div class="row" style="float: left;width:70%">
			<div >
				<div class="page-header" id="HEAGER">
					<h1>常见问题</h1>
					<h5 id="getTime"></h5>
				</div>
				<!--chaxun -->
				<div class="col-lg-6">
					<div class="input-group">
						<input type="text" class="form-control" placeholder="Search for..."> 
						<span class="input-group-btn">
							<button class="btn btn-default" type="button">Go!</button>
						</span>
					</div>
				</div>
				<!-- 显示表格数据-->
				<div class="row" id="FQA">
					<div class="col-md-12">
						<h2>项目QA</h2>
						<table class="table table-hover" id="questionAll_table">
							<tbody>

							</tbody>
						</table>
					</div>
				</div>
				<!-- 显示表格数据-->
				<div class="row" id="XIN">
					<div class="col-md-12">
						<h2>最新发布</h2>
						<table class="table table-hover" id="questionOtherD_table">
							<tbody>

							</tbody>
						</table>
					</div>
				</div>

				<!-- 显示表格数据-->
				<div class="row" id="WEN">
					<div class="col-md-12">
						<h2>相关文档</h2>
						<table class="table table-hover" id="questionOther_table">
							<tbody>

							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		
		<div style="float: left;position:fixed; left:70%;top:50px">
			<!--导航 -->
			<ul class="nav nav-pills nav-stacked">
				<li role="presentation" class="active"><a>本页目录</a></li>
				<li role="presentation"><a href="#HEAGER">快速查询</a></li>
				<li role="presentation"><a href="#FQA">项目FQA</a></li>
				<li role="presentation"><a href="#XIN">最新发布</a></li>
				<li role="presentation"><a href="#WEN">相关文档</a></li>
			</ul>
		</div>

	</div>

	<script type="text/javascript">
		//页面加载完毕后，发送ajax请求
		$(function() {
			$.ajax({
				url : "${APP_PATH}/getAllQuestionAll",
				data : "pn=1",
				type : "GET",
				success : function(result1) {
					build_questionAll_table(result1);
				}
			});
		})
		function build_questionAll_table(result1) {
			//清空表格
			$("#questionAll_table tbody").empty();
			var questionAll = result1.extend.pageInfo.list;
			$.each(questionAll, function(index, item) {
				var questionNameTd = $("<li></li>").append(
						$("<a></a>").append(item.questionName).attr("href", "question_list.jsp#Q"+item.questionId));
				$("<ul></ul>").append(questionNameTd).appendTo(
						"#questionAll_table tbody");
			});
		}

		$(function() {
			$.ajax({
				url : "${APP_PATH}/getAllQuestionOther",
				data : "pn=1",
				type : "GET",
				success : function(result2) {
					build_questionOther_table(result2);
				}
			});
		})
		function build_questionOther_table(result2) {
			//清空表格
			$("#questionOther_table tbody").empty();
			var questionOther = result2.extend.pageInfo.list;
			$.each(questionOther, function(index, item) {
				var questionotherNameTd = $("<li></li>").append(
						$("<a></a>").append(item.questionotherName).attr("href", "question_list.jsp#Q"+item.questionId));
				$("<ul></ul>").append(questionotherNameTd).appendTo("#questionOther_table tbody");
			});
		}

		$(function() {
			$.ajax({
				url : "${APP_PATH}/getAllQuestionOtherTime",
				data : "pn=1",
				type : "GET",
				success : function(result3) {
					build_questionOtherD_table(result3);
				}
			});
		})
		function build_questionOtherD_table(result3) {
			//清空表格
			$("#questionOtherD_table tbody").empty();
			var questionOtherD = result3.extend.pageInfo.list;
			$.each(questionOtherD, function(index, item) {
				var questionotherNameTd = $("<li></li>").append(
						$("<a></a>").append(item.questionotherName).attr("href", "question_list.jsp#Q"+item.questionId));
				$("<ul></ul>").append(questionotherNameTd).appendTo("#questionOtherD_table tbody");
			});
		}

	</script>
</body>
</html>